package com.boss.service.impl;

import com.boss.entity.AddressClassify;
import com.boss.mapper.AddressClassifyMapper;
import com.boss.service.AddressClassifyService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;
@Service
public class AddressClassifyServiceImpl implements AddressClassifyService {
    @Autowired
    private AddressClassifyMapper addressClassifyMapper;
    //获取所有城市
    @Override
    public List<AddressClassify> getAllAddressClassify1(Integer parentId) {
//        判断参数是否合法
        if (parentId != null){
            if(parentId < 1){
                parentId = null;
            }else if(parentId > 10000000){
                parentId = null;
            }
        }
        return addressClassifyMapper.getAllAddressClassify1(parentId);
    }
    //根据i城市id获取城市
    @Override
    public AddressClassify getAddressClassifyById(Integer addressClassifyId) {
        return addressClassifyMapper.getAddressClassifyById(addressClassifyId);
    }
}
